<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Points and Rectangles</title>
<meta name="generator" content="DocBook XSL Stylesheets V1.76.1">
<link rel="home" href="index.html" title="GDK 3 参考手册">
<link rel="up" href="reference.html" title="API参考">
<link rel="prev" href="gdk3-GdkDevice.html" title="GdkDevice">
<link rel="next" href="gdk3-Pixbufs.html" title="Pixbufs">
<meta name="generator" content="GTK-Doc V1.17 (XML mode)">
<link rel="stylesheet" href="style.css" type="text/css">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="2">
<tr valign="middle">
<td><a accesskey="p" href="gdk3-GdkDevice.html"><img src="left.png" width="24" height="24" border="0" alt="Prev"></a></td>
<td><a accesskey="u" href="reference.html"><img src="up.png" width="24" height="24" border="0" alt="Up"></a></td>
<td><a accesskey="h" href="index.html"><img src="home.png" width="24" height="24" border="0" alt="Home"></a></td>
<th width="100%" align="center">GDK 3 参考手册</th>
<td><a accesskey="n" href="gdk3-Pixbufs.html"><img src="right.png" width="24" height="24" border="0" alt="Next"></a></td>
</tr>
<tr><td colspan="5" class="shortcuts">
<a href="#gdk3-Points-Rectangles-and-Regions.synopsis" class="shortcut">Top</a>
                   | 
                  <a href="#gdk3-Points-Rectangles-and-Regions.description" class="shortcut">Description</a>
</td></tr>
</table>
<div class="refentry">
<a name="gdk3-Points-Rectangles-and-Regions"></a><div class="titlepage"></div>
<div class="refnamediv"><table width="100%"><tr>
<td valign="top">
<h2><span class="refentrytitle"><a name="gdk3-Points-Rectangles-and-Regions.top_of_page"></a>Points and Rectangles</span></h2>
<p>Points and Rectangles — Simple graphical data types</p>
</td>
<td valign="top" align="right"></td>
</tr></table></div>
<div class="refsynopsisdiv">
<a name="gdk3-Points-Rectangles-and-Regions.synopsis"></a><h2>Synopsis</h2>
<pre class="synopsis">
#include &lt;gdk/gdk.h&gt;

struct              <a class="link" href="gdk3-Points-Rectangles-and-Regions.html#GdkPoint" title="struct GdkPoint">GdkPoint</a>;

typedef             <a class="link" href="gdk3-Points-Rectangles-and-Regions.html#GdkRectangle" title="GdkRectangle">GdkRectangle</a>;
<a href="../glib/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>            <a class="link" href="gdk3-Points-Rectangles-and-Regions.html#gdk-rectangle-intersect" title="gdk_rectangle_intersect ()">gdk_rectangle_intersect</a>             (<em class="parameter"><code>const <a class="link" href="gdk3-Points-Rectangles-and-Regions.html#GdkRectangle" title="GdkRectangle"><span class="type">GdkRectangle</span></a> *src1</code></em>,
                                                         <em class="parameter"><code>const <a class="link" href="gdk3-Points-Rectangles-and-Regions.html#GdkRectangle" title="GdkRectangle"><span class="type">GdkRectangle</span></a> *src2</code></em>,
                                                         <em class="parameter"><code><a class="link" href="gdk3-Points-Rectangles-and-Regions.html#GdkRectangle" title="GdkRectangle"><span class="type">GdkRectangle</span></a> *dest</code></em>);
<span class="returnvalue">void</span>                <a class="link" href="gdk3-Points-Rectangles-and-Regions.html#gdk-rectangle-union" title="gdk_rectangle_union ()">gdk_rectangle_union</a>                 (<em class="parameter"><code>const <a class="link" href="gdk3-Points-Rectangles-and-Regions.html#GdkRectangle" title="GdkRectangle"><span class="type">GdkRectangle</span></a> *src1</code></em>,
                                                         <em class="parameter"><code>const <a class="link" href="gdk3-Points-Rectangles-and-Regions.html#GdkRectangle" title="GdkRectangle"><span class="type">GdkRectangle</span></a> *src2</code></em>,
                                                         <em class="parameter"><code><a class="link" href="gdk3-Points-Rectangles-and-Regions.html#GdkRectangle" title="GdkRectangle"><span class="type">GdkRectangle</span></a> *dest</code></em>);
</pre>
</div>
<div class="refsect1">
<a name="gdk3-Points-Rectangles-and-Regions.description"></a><h2>Description</h2>
<p>
GDK provides the <a class="link" href="gdk3-Points-Rectangles-and-Regions.html#GdkPoint" title="struct GdkPoint"><span class="type">GdkPoint</span></a> and <a class="link" href="gdk3-Points-Rectangles-and-Regions.html#GdkRectangle" title="GdkRectangle"><span class="type">GdkRectangle</span></a> data types for representing pixels
and sets of pixels on the screen. Together with Cairo's <a href="../cairo/cairo-Regions.html#cairo-region-t"><span class="type">cairo_region_t</span></a> data
type, they make up the central types for representing graphical data.
</p>
<p>
<a class="link" href="gdk3-Points-Rectangles-and-Regions.html#GdkPoint" title="struct GdkPoint"><span class="type">GdkPoint</span></a> is a simple structure containing an x and y coordinate of a point.
</p>
<p>
<a class="link" href="gdk3-Points-Rectangles-and-Regions.html#GdkRectangle" title="GdkRectangle"><span class="type">GdkRectangle</span></a> is a structure holding the position and size of a rectangle.
The intersection of two rectangles can be computed with
<a class="link" href="gdk3-Points-Rectangles-and-Regions.html#gdk-rectangle-intersect" title="gdk_rectangle_intersect ()"><code class="function">gdk_rectangle_intersect()</code></a>. To find the union of two rectangles use
<a class="link" href="gdk3-Points-Rectangles-and-Regions.html#gdk-rectangle-union" title="gdk_rectangle_union ()"><code class="function">gdk_rectangle_union()</code></a>.
</p>
<p>
<a href="../cairo/cairo-Regions.html#cairo-region-t"><span class="type">cairo_region_t</span></a> is usually used for managing clipping of graphical operations.
</p>
</div>
<div class="refsect1">
<a name="gdk3-Points-Rectangles-and-Regions.details"></a><h2>Details</h2>
<div class="refsect2">
<a name="GdkPoint"></a><h3>struct GdkPoint</h3>
<pre class="programlisting">struct GdkPoint {
  gint x;
  gint y;
};
</pre>
<p>
Defines the x and y coordinates of a point.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><a href="../glib/glib-Basic-Types.html#gint"><span class="type">gint</span></a> <em class="structfield"><code><a name="GdkPoint.x"></a>x</code></em>;</span></p></td>
<td>the x coordinate of the point.</td>
</tr>
<tr>
<td><p><span class="term"><a href="../glib/glib-Basic-Types.html#gint"><span class="type">gint</span></a> <em class="structfield"><code><a name="GdkPoint.y"></a>y</code></em>;</span></p></td>
<td>the y coordinate of the point.</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2">
<a name="GdkRectangle"></a><h3>GdkRectangle</h3>
<pre class="programlisting">typedef cairo_rectangle_int_t         GdkRectangle;
</pre>
<p>
Defines the position and size of a rectangle. It is identical to
<a href="../cairo/cairo-Types.html#cairo-rectangle-int-t"><span class="type">cairo_rectangle_int_t</span></a>.
</p>
</div>
<hr>
<div class="refsect2">
<a name="gdk-rectangle-intersect"></a><h3>gdk_rectangle_intersect ()</h3>
<pre class="programlisting"><a href="../glib/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>            gdk_rectangle_intersect             (<em class="parameter"><code>const <a class="link" href="gdk3-Points-Rectangles-and-Regions.html#GdkRectangle" title="GdkRectangle"><span class="type">GdkRectangle</span></a> *src1</code></em>,
                                                         <em class="parameter"><code>const <a class="link" href="gdk3-Points-Rectangles-and-Regions.html#GdkRectangle" title="GdkRectangle"><span class="type">GdkRectangle</span></a> *src2</code></em>,
                                                         <em class="parameter"><code><a class="link" href="gdk3-Points-Rectangles-and-Regions.html#GdkRectangle" title="GdkRectangle"><span class="type">GdkRectangle</span></a> *dest</code></em>);</pre>
<p>
Calculates the intersection of two rectangles. It is allowed for
<em class="parameter"><code>dest</code></em> to be the same as either <em class="parameter"><code>src1</code></em> or <em class="parameter"><code>src2</code></em>. If the rectangles 
do not intersect, <em class="parameter"><code>dest</code></em>'s width and height is set to 0 and its x 
and y values are undefined. If you are only interested in whether
the rectangles intersect, but not in the intersecting area itself,
pass <a href="../glib/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> for <em class="parameter"><code>dest</code></em>.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>src1</code></em> :</span></p></td>
<td>a <a class="link" href="gdk3-Points-Rectangles-and-Regions.html#GdkRectangle" title="GdkRectangle"><span class="type">GdkRectangle</span></a>
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>src2</code></em> :</span></p></td>
<td>a <a class="link" href="gdk3-Points-Rectangles-and-Regions.html#GdkRectangle" title="GdkRectangle"><span class="type">GdkRectangle</span></a>
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>dest</code></em> :</span></p></td>
<td>return location for the
intersection of <em class="parameter"><code>src1</code></em> and <em class="parameter"><code>src2</code></em>, or <a href="../glib/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>. <span class="annotation">[<acronym title="Parameter for returning results. Default is transfer full."><span class="acronym">out</span></acronym> caller-allocates][<acronym title="NULL is ok, both for passing and for returning."><span class="acronym">allow-none</span></acronym>]</span>
</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>
<a href="../glib/glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> if the rectangles intersect.</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2">
<a name="gdk-rectangle-union"></a><h3>gdk_rectangle_union ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>                gdk_rectangle_union                 (<em class="parameter"><code>const <a class="link" href="gdk3-Points-Rectangles-and-Regions.html#GdkRectangle" title="GdkRectangle"><span class="type">GdkRectangle</span></a> *src1</code></em>,
                                                         <em class="parameter"><code>const <a class="link" href="gdk3-Points-Rectangles-and-Regions.html#GdkRectangle" title="GdkRectangle"><span class="type">GdkRectangle</span></a> *src2</code></em>,
                                                         <em class="parameter"><code><a class="link" href="gdk3-Points-Rectangles-and-Regions.html#GdkRectangle" title="GdkRectangle"><span class="type">GdkRectangle</span></a> *dest</code></em>);</pre>
<p>
Calculates the union of two rectangles.
The union of rectangles <em class="parameter"><code>src1</code></em> and <em class="parameter"><code>src2</code></em> is the smallest rectangle which
includes both <em class="parameter"><code>src1</code></em> and <em class="parameter"><code>src2</code></em> within it.
It is allowed for <em class="parameter"><code>dest</code></em> to be the same as either <em class="parameter"><code>src1</code></em> or <em class="parameter"><code>src2</code></em>.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>src1</code></em> :</span></p></td>
<td>a <a class="link" href="gdk3-Points-Rectangles-and-Regions.html#GdkRectangle" title="GdkRectangle"><span class="type">GdkRectangle</span></a>
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>src2</code></em> :</span></p></td>
<td>a <a class="link" href="gdk3-Points-Rectangles-and-Regions.html#GdkRectangle" title="GdkRectangle"><span class="type">GdkRectangle</span></a>
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>dest</code></em> :</span></p></td>
<td>return location for the union of <em class="parameter"><code>src1</code></em> and <em class="parameter"><code>src2</code></em>. <span class="annotation">[<acronym title="Parameter for returning results. Default is transfer full."><span class="acronym">out</span></acronym>]</span>
</td>
</tr>
</tbody>
</table></div>
</div>
</div>
</div>
<div class="footer">
<hr>
          Generated by GTK-Doc V1.17</div>
</body>
</html>